<?php
namespace TwOauth;

use Illuminate\Support\Facades\App;

class Config
{
    // 本地域名
    const DOMAIN_LOCAL = 'http://passport.tongwei.com/';
    // 测试域名
    const DOMAIN_DEV = 'http://test.tongwei.cn/Oauth/';
    // 正式域名
    const DOMAIN_MASTER = 'http://passport.tongwei.cn/';
    // 地址 注册
    const URI_SIGN_UP = 'Index/signUp';
    // 地址 oauth_code
    const API_URI_OAUTH_CODE = 'Index/index';
    // 地址 access_token
    const API_URI_ACCESS_TOKEN = 'ApiOauth/getAccessToken';
    // 地址 user_info
    const API_URI_USER_INFO = 'ApiOauthUser/getUserInfo';
    // 地址 user_profile
    const API_URI_USER_PROFILE = 'ApiOauthUser/getUserProfile';

    public static function getDomain()
    {
        if (App::environment('master')) {
            return self::DOMAIN_MASTER;
        } elseif (App::environment('dev')) {
            return self::DOMAIN_DEV;
        } else {
            return self::DOMAIN_LOCAL;
        }
    }

    public static function getSignUp()
    {
        return self::getDomain() . self::URI_SIGN_UP;
    }

    public static function getOauthCode()
    {
        return self::getDomain() . self::API_URI_OAUTH_CODE;
    }

    public static function getAccessToken()
    {
        return self::getDomain() . self::API_URI_ACCESS_TOKEN;
    }

    public static function getUserInfo()
    {
        return self::getDomain() . self::API_URI_USER_INFO;
    }

    public static function getUserProfile()
    {
        return self::getDomain() . self::API_URI_USER_PROFILE;
    }
}